package com.woniuxy.microfundservice.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WorkDayDao {
    //获取传入日期过后的几个交易日(包括今日)
    @Select("select workday FROM workday_info WHERE workday>=#{parchaseDay} ORDER BY workday LIMIT #{tDay}")
    List<Integer> getWorkDatesIncludeToday (@Param("parchaseDay") Integer parchaseDay, @Param("tDay") Integer tDay);

    //获取传入日期过后的几个交易日(不包括今日)
    @Select("select workday FROM workday_info WHERE workday>#{parchaseDay} ORDER BY workday LIMIT #{tDay}")
    List<Integer> getWorkDates (@Param("parchaseDay") Integer parchaseDay, @Param("tDay") Integer tDay);

    //获取传入日期过后的第一个交易日(不包括今日)
    @Select("select workday FROM workday_info WHERE workday>#{parchaseDay} ORDER BY workday LIMIT 1")
    Integer getAfterWorkDates (@Param("parchaseDay") Integer parchaseDay);

    //获取传入日期过后的第二个交易日(不包括今日)
    @Select("select workday FROM workday_info WHERE workday>#{parchaseDay} ORDER BY workday LIMIT 2")
    List<Integer> getSecondWorkDates (@Param("parchaseDay") Integer parchaseDay);

}
